<?php 
get_header();
?>

<div id="main">
<div id="content" class="narrowcolumn">

<?php

if ($album) {
		?>
<h2><?php echo $album->title ; ?></h2>
<?php
if ($album->description) {
?>
<div id="description">
<?php
	echo $album->description ;
?>
</div>
<?php
}
if ($album->images) {
?>
<div id="photos">
	<table>
		<tr>
<?php
	foreach ($album->images as $photo) {
		$i++;
		$metadata = wpsary_maybe_unserialize($photo->metadata);
		
		?>
			<td width="130" align="center">
			<a href="<?php echo  get_bloginfo('siteurl') . "/" . $_SERVER['REQUEST_URI'] . "/" . $album->id . "/" . $photo->id ;?>"><img src="<?php 
			echo $album->url  . $metadata['thumb'] . "\" "; 
			echo $metadata['hwstring_small'] ;
			?> border="0"/></a>

	<?php
		if ($photo->title) {?>
	<div id="photocaption">
		<a href="<?php echo  get_bloginfo('siteurl') . "/" . $_SERVER['REQUEST_URI'] . "/" . $album->id . "/" . $photo->id ;?>"><?php echo  $photo->title; ?></a>
	</div>
			</td>
			<?php
		}
		if ($i % get_option('wpsary_colnumbers') == 0 ) {
			echo "</tr><tr>";
		}
	}
	?>
		</tr>
	</table>
</div>
	<?php
} else {
	_e('No image found', 'wpsary');
}

?>


<?php
} else {
	_e('No album found', 'wpsary');
}

?>
</div>
<?php
get_sidebar();
?>
</div>
<?
get_footer();
?>